package core.rpt.model;

import java.util.HashMap;
import java.util.Map;

import core.rpt.ExcelUtil;

public class ShopDetail implements Comparable<ShopDetail> {
	public static final Map<String, Integer> SHOP_COL_COUNT = new HashMap<String, Integer>();

	static {
		SHOP_COL_COUNT.put("1", 8);
		SHOP_COL_COUNT.put("2", 8);
		SHOP_COL_COUNT.put("3", 4);
		SHOP_COL_COUNT.put("4", 4);
		SHOP_COL_COUNT.put("6", 4);
		SHOP_COL_COUNT.put("7", 4);
		SHOP_COL_COUNT.put("5", 4);
		SHOP_COL_COUNT.put("DX", 2);
	}

	Integer shopId;
	String attributeId;
	String shopName;
	Integer shopColumn;

	public Integer getShopId() {
		return shopId;
	}

	public void setShopId(Integer shopId) {
		this.shopId = shopId;
	}

	public String getAttributeId() {
		return attributeId;
	}

	public void setAttributeId(String attributeId) {
		this.attributeId = attributeId;
	}

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}
	
	public Integer getShopColumn() {
		return shopColumn;
	}

	public void setShopColumn(Integer shopColumn) {
		this.shopColumn = shopColumn;
	}

	@Override
	public int compareTo(ShopDetail s) {
		int idx = this.attributeId.compareTo(s.attributeId);
		if (idx != 0) {
			return idx;
		}
		return this.shopId - s.shopId;
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof ShopDetail)) {
			return false;
		}
		ShopDetail s = (ShopDetail) o;
		return this.attributeId.equals(s.attributeId) && this.shopId.equals(shopId);
	}
	
	@Override
	public int hashCode() {
		return this.attributeId.hashCode() ^ this.shopId.hashCode();
	}
	
	public String toString() {
		return "Shop Id: " + shopId + " Name: " + shopName + " Attr: " + attributeId + " Col: " + ExcelUtil.getColumnAlphNameByIndex(shopColumn);
	}
}
